package com.winning.shiro.web;

import org.apache.shiro.authz.annotation.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author Lenovo
 * @title
 * @project shiro-web
 * @package com.winning.shiro.web
 * @date: 2019-01-18 15:38
 */
@Controller
public class PageController {

    @RequestMapping(value = "/")
    @RequiresGuest
    public String index(){
        return "login";
    }

    @RequestMapping(value = "user")
    @RequiresUser
    @RequiresRoles(value = {"user","admin"},logical = Logical.OR)
    public String userIndex(){
        return "user";
    }

    @RequestMapping(value = "admin")
    @RequiresAuthentication
    @RequiresRoles(value = {"admin"})
    public String adminIndex(){
        return "admin";
    }


}
